import { UpdatePasswordCmd } from './../../dto/user/index';
import 'dotenv/config';
import type { VercelRequest, VercelResponse } from '@vercel/node';
import { handleExceptionRequireLogin } from '../../util/exception';
import { updatePass } from '../../service/user/UserService';
import { success } from '../../util/result';

/**
 * 更改密码接口
 */
export default  (_req: VercelRequest, _res: VercelResponse) => {
    return handleExceptionRequireLogin(_req,_res,async (request,response,username) => {
        await updatePass(request.body as UpdatePasswordCmd,username);
        return response.json(success())
    })
}